package com.myframework.servlets;

import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;

import com.myframework.utils.logutil.WMLogger;

/**
 * Initialize the system configuration
 */
public class WMServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;

	@Override
	public void init(ServletConfig config) throws ServletException {
		super.init(config);

		// Initialize the log4j configuration
		WMLogger.init();

		String level = getServletConfig().getInitParameter("level");
		if (null != level) {
			WMLogger.setLevel(level);
			WMLogger.info("Initialize the logging level to: " + level);
		} else {
			WMLogger.setLevel(WMLogger.LEVEL_DEBUG);
			WMLogger.info("Initialize the logging level to: DEBUG");
		}
		
		// Initial
	}

	@Override
	public void destroy() {
		System.gc();
	}

}
